package com.qf.filters;

import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.exception.ZuulException;
import org.springframework.cloud.netflix.zuul.filters.support.FilterConstants;
import org.springframework.stereotype.Component;
// 路由的时候执行   环绕
@Component
public class MyRouteFilter extends ZuulFilter {

//    过滤器类型
    @Override
    public String filterType() {
//        前置
        return FilterConstants.ROUTE_TYPE;
    }
//      过滤器顺序
    @Override
    public int filterOrder() {
        return 1;
    }

// 是否执行当前方法
    @Override
    public boolean shouldFilter() {
        return true;
    }

//    要执行的方法
    @Override
    public Object run() throws ZuulException {
        System.out.println("MyRouteFilter 执行了");
        return null;
    }
}
